(function () {
    let template = function (self) {
        return `
<aux-view class="aux-button">
    <aux-view class="btn">${self.innerHTML}</aux-view>
    <aux-view class="mask"></aux-view>
</aux-view>
        `;
    };    

    function handleDisabled(self, newval, oldval) {
        if (newval && newval != null) {
            if (!self.$locked) {
                self.$locked = true;
            }
        } else {
            if (self.$locked) {
                self.$locked = false;
            }
        }
    }

    document.auiDefineElement("aux-button", {
        template,
        props: {
            "disabled": {
                afterCreated(self, newval) {
                    handleDisabled(self, newval);
                },
                observer(self, oldval, newval) {
                    handleDisabled(self, newval);
                }
            }
        },
        attached: function(self) {
            self.$locked = false;
            self.$type = self.auiGetAttribute("form-type", "button");
        }
    });
})();



